package com.itheima.aop;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component("teacher")
@Aspect //设置切面类
public class Teacher {

    //配置点
    @Pointcut("execution(* *..*(..))")
    public void pc(){

    }

/*        @Around("pc()")//环绕通知
    public Object around(ProceedingJoinPoint pjp){
        System.out.println("每日回顾");
        Object ret=null;

        try {
            //对原始方法的调用
            ret=pjp.proceed();

            System.out.println("每日总结");
        } catch (Throwable throwable) {
            System.out.println("解答问题");
        } finally {
            System.out.println("高薪就业");
        }
            return ret;

    }*/

      @Before("pc()")
    public void before(){
          System.out.println(1);
      }
      @AfterReturning("pc()")
    public void afterReturing(){
          System.out.println(2);
      }
      @AfterThrowing("pc()")
    public void afterThrowing(){
          System.out.println(3);
      }
      @After("pc()")
    public void after(){
          System.out.println(4);
      }



}
